package crowMessenger;

import java.util.ArrayList;

import javax.swing.JTabbedPane;

public class ChatTabs extends JTabbedPane{
	private static final long serialVersionUID = 5749425529818891608L;
	private ArrayList<Buddy> chatList = new ArrayList<Buddy>();

	/* Constructor */
	public ChatTabs(Buddy buddy){
		addNewChat(buddy);
	}

	protected void addNewChat(Buddy b){
		if(!chatList.contains(b)){
			chatList.add(b);
			addTab(b.getNickname(), new ChatPanel(b));
		}else{
			setSelectedIndex(chatList.indexOf(b));
		}
	}
}
